package com.xuexi.mr.fof;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Reducer;

public class FriendsReducer extends Reducer<FoF, IntWritable, FoF, IntWritable>{

	protected void reduce(FoF arg0, Iterable<IntWritable> arg1,
			Context arg2)
			throws IOException, InterruptedException {
		int sum=0;
		boolean f=true;
		for(IntWritable i :arg1){
			if(i.get()==2){
				f=false;
				break;
			}
			sum=sum+i.get();
		}
		if(f){
			arg2.write(arg0, new IntWritable(sum));
		}
	}
}
